package com.example.activity;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

public class MainActivity2 extends AppCompatActivity {

    private final String TAG = "MainActivity";

    @SuppressLint("MissingInflatedId")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_main2);
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
            Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
            return insets;
        });
        //获取包裹信息
        Bundle bundle = getIntent().getExtras();
        if (bundle != null) {
            String time = bundle.getString("time");
            String content = bundle.getString("content");
            TextView tv_receive = findViewById(R.id.tv_receive);
            tv_receive.setText(String.format("接受消息:\n时间:%s\n内容:%s", time, content));
        }
        //
        findViewById(R.id.btn_back).setOnClickListener(v -> {
            //结束当前activity
            finish();
        });
    }
}